*********************************************************************************************
*Replication code for Oliver, Steven, Ryan Jablonski, Justin Hastings. 
*"The Tortuga Disease: The Perverse Effects of Illicit Wealth" Forthcoming International Studies Quarterly (Accepted May 2016)
*Creates Figure A1
*Version 10 June, 2016
*********************************************************************************************
clear *
cd "<directory location>"
use RansomData.dta, clear
sort year month
keep if region==1

 sort year month
egen month_display = group(year month)
tsset month_display 


sum puntland_exports, detail
local m=round(r(mean))
local s=round(r(sd))
local pos1 = (`r(max)'-.1*`r(max)')
local pos2 = (`r(max)'-.24*`r(max)')

#delimit ;
twoway  area puntland_exports   month_display,  lcolor(gray) fcolor(gray) 
			xlabel(0 "05" 12 "06"  24 "07" 36 "08" 48 "09" 60 "10" 72 "11" 84 "12" 96 "13",   labsize(5))
			ylabel(0 "0" 5000000 "5"  10000000 "10" 15000000 "15" 20000000 "20" , labsize(5) axis(1) glcolor(white)) 
             title(" ", size(4))
             subtitle( "Puntland Exports"  "(Million USD)", size(6))
             xtitle( "Year", size(5)  )
			 ytitle("", size(5) )
             xsca(titlegap(2))
             ysca(titlegap(2))
             scheme(s2mono) graphregion(fcolor(white))
			 xsize(5) ysize(5)
			 text(`pos1' 20 "Mean=`m'", size(5))
			 text(`pos2' 17 "SD=`s'", size(5))
			 graphregion( fcolor(white) style(none)  color(white) )
			  ;
#delimit cr
graph export "SummaryPanelA.tif", width(3000) replace

sum somaliland_exports
local m=round(r(mean))
local s=round(r(sd))
local pos1 = (`r(max)'-.1*`r(max)')
local pos2 = (`r(max)'-.24*`r(max)')
#delimit ;
twoway  bar somaliland_exports   month_display,  lcolor(gray) fcolor(gray) 
			xlabel(0 "05" 12 "06"  24 "07" 36 "08" 48 "09" 60 "10" 72 "11" 84 "12" 96 "13",   labsize(5))
			ylabel(0 "0" 10000000 " "  20000000 "20" 30000000 " " 40000000 "40" 50000000 " " 60000000 "60" 80000000 "80", labsize(5) axis(1) glcolor(white)) 
             title(" ", size(4))
             subtitle("Somaliland Exports" "(Million USD)", size(6))
             xtitle( "Year", size(5)  )
			 ytitle("", size(5) )
             xsca(titlegap(2))
             ysca(titlegap(2))
             scheme(s2mono) graphregion(fcolor(white))
			 xsize(5) ysize(5)
			 text(`pos1' 20 "Mean=`m'", size(5))
			 text(`pos2' 19 "SD=`s'", size(5))
			 graphregion( fcolor(white) style(none)  color(white) )
			  ;
#delimit cr
graph export "SummaryPanelB.tif", width(3000) replace


sum puntland_imports
local m=round(r(mean))
local s=round(r(sd))
local pos1 = (`r(max)'-.1*`r(max)')
local pos2 = (`r(max)'-.24*`r(max)')
#delimit ;
twoway  bar puntland_imports   month_display,  lcolor(gray) fcolor(gray) 
			xlabel(0 "05" 12 "06"  24 "07" 36 "08" 48 "09" 60 "10" 72 "11" 84 "12" 96 "13",   labsize(5))
			ylabel(0 "0" 5000000 "5"  10000000 "10" 15000000 "15" 20000000 "20" 25000000 "25", labsize(5) axis(1) glcolor(white)) 
             title(" ", size(4))
             subtitle( "Puntland Imports"  "(Million USD)", size(6))
             xtitle( "Year", size(5)  )
			 ytitle("", size(5) )
             xsca(titlegap(2))
             ysca(titlegap(2))
             scheme(s2mono) graphregion(fcolor(white))
			 xsize(5) ysize(5)
			 text(`pos1' 20 "Mean=`m'", size(5))
			 text(`pos2' 17.5 "SD=`s'", size(5))
			 graphregion( fcolor(white) style(none)  color(white) )
			  ;
#delimit cr
graph export "SummaryPanelC.tif", width(3000) replace

sum somaliland_imports
local m=round(r(mean))
local s=round(r(sd))
local pos1 = (`r(max)'+.05*`r(max)')
local pos2 = (`r(max)'-.10*`r(max)')
#delimit ;
twoway  bar somaliland_imports   month_display,  lcolor(gray) fcolor(gray) 
			xlabel(0 "05" 12 "06"  24 "07" 36 "08" 48 "09" 60 "10" 72 "11" 84 "12" 96 "13",   labsize(5))
			ylabel(0 "0" 5000000 "5"  10000000 "10" 15000000 "15" 20000000 "20" 25000000 "25"  30000000 "30"  35000000 "35" , labsize(5) axis(1) glcolor(white)) 
             title(" ", size(4))
             subtitle( "Somaliland Imports"  "(Million USD)", size(6))
             xtitle( "Year", size(5)  )
			 ytitle("", size(5) )
             xsca(titlegap(2))
             ysca(titlegap(2))
             scheme(s2mono) graphregion(fcolor(white))
			 xsize(5) ysize(5)
			 text(`pos1' 20 "Mean=`m'", size(5))
			 text(`pos2' 15.5 "SD=`s'", size(5))
			 graphregion( fcolor(white) style(none)  color(white) )
			  ;
#delimit cr
graph export "SummaryPanelD.tif", width(3000) replace

sum real_avg_usd_sosh
local m=round(r(mean)*1000)/1000
local s=round(r(sd)*1000)/1000
local pos1 = (`r(max)'-.1*`r(max)')
local pos2 = (`r(max)'-.24*`r(max)')
#delimit ;
twoway  line real_avg_usd_sosh   month_display,  lwidth(thick) lcolor(gray) fcolor(gray) 
			xlabel(0 "05" 12 "06"  24 "07" 36 "08" 48 "09" 60 "10" 72 "11" 84 "12" 96 "13",   labsize(5))
			ylabel(0 "0" .05 "0.05"  .10 "0.10"  .15 "0.15" , labsize(5) axis(1) glcolor(white)) 
             title(" ", size(4))
             subtitle( "Puntland Exchange Rate"  "(USD per 1000 Somali Shillings)", size(6))
             xtitle( "Year", size(5)  )
			 ytitle("", size(5) )
             xsca(titlegap(2))
             ysca(titlegap(2))
             scheme(s2mono) graphregion(fcolor(white))
			 xsize(5) ysize(5)
			 text(`pos1' 15 "Mean=`m'", size(5))
			 text(`pos2' 10.5 "SD=`s'", size(5))
			 graphregion( fcolor(white) style(none)  color(white) )
			  ;
#delimit cr
graph export "SummaryPanelE.tif", width(3000) replace

sum real_avg_usd_slsh
local m=round(r(mean)*1000)/1000
local s=round(r(sd)*1000)/1000
local pos1 = (`r(max)'-0*`r(max)')
local pos2 = (`r(max)'-.15*`r(max)')
#delimit ;
twoway  line real_avg_usd_slsh   month_display,  lwidth(thick) lcolor(gray) fcolor(gray) 
			xlabel(0 "05" 12 "06"  24 "07" 36 "08" 48 "09" 60 "10" 72 "11" 84 "12" 96 "13",   labsize(5))
			ylabel(0 "0" .10 " " .20 "0.20" .30 " "  .40 "0.40"  .50 " " , labsize(5) axis(1) glcolor(white)) 
             title(" ", size(4))
             subtitle( "Somaliland Exchange Rate"  "(USD per 1000 Somaliland Shillings)", size(6))
             xtitle( "Year", size(5)  )
			 ytitle("", size(5) )
             xsca(titlegap(2))
             ysca(titlegap(2))
             scheme(s2mono) graphregion(fcolor(white))
			 xsize(5) ysize(5)
			 text(`pos1' 13.5 "Mean=`m'", size(5))
			 text(`pos2' 12.5 "SD=`s'", size(5))
			 graphregion( fcolor(white) style(none)  color(white) )
			  ;
#delimit cr
graph export "SummaryPanelF.tif", width(3000) replace



